#pragma once
#include <fstream>
#include <istream>


using namespace std;
class GameData
{
public:
	float ControlledAcres;
	
	static const unsigned int MaxExpeditions = 3; 
	unsigned int HelpersAvailable;
	unsigned int HelpersExploring;
	unsigned int HelpersWorking;
	float Gold;
	float GoldCoef;
	float ExploringCoeff;
	float Bartering;
	int Igloos;
	int PolarbearGrinders;
	int CandyCaneFactories;
	int RaindeerFarms;
	int CandyCanes;
	int CandyCaneUpkeep;
	int InhabitansPerIgloo;
	int Expeditions[MaxExpeditions];
	float TimeForExpeditionsToReturn[MaxExpeditions];
	int TimeInExpedition[MaxExpeditions];
	int Raindeers;
	int KilosOfPolarbearMeat;
	int RaindeerNumOfHelpers;

#pragma region Insertion & extraction
	// Extraction operator
	friend std::istream& operator>>(std::istream& is, GameData& data)
	{
		// read in individual members of data
		is  
			>> data.HelpersAvailable 
			>> data.HelpersExploring 
			>> data.HelpersWorking 
			>> data.ControlledAcres 
			>> data.Gold 
			>> data.GoldCoef
			>> data.ExploringCoeff 
			>> data.Igloos 
			>> data.CandyCanes 
			>> data.CandyCaneFactories 
			>> data.InhabitansPerIgloo 
			>> data.PolarbearGrinders 
			>> data.RaindeerFarms 
			>> data.Raindeers 
			>> data.KilosOfPolarbearMeat
			>> data.RaindeerNumOfHelpers;
		for(unsigned int i = 0; i < MaxExpeditions; i++)
		{
			is >> data.Expeditions[i] >> data.TimeForExpeditionsToReturn[i] >> data.TimeInExpedition[i];
		}
	
		
		return is;
	}
	

	// Insertion operator
	friend std::ostream& operator<<(std::ostream& os, const GameData& data)
	{
		// write out individual members of data with an end of line between each one
		os << data.HelpersAvailable		<< '\n';
		os << data.HelpersExploring		<< '\n';
		os << data.HelpersWorking		<< '\n';
		os << data.ControlledAcres		<< '\n';
		os << data.Gold					<< '\n';
		os << data.GoldCoef				<< '\n';
		os << data.ExploringCoeff		<< '\n';
		os << data.Igloos				<< '\n';
		os << data.CandyCanes			<< '\n';
		os << data.CandyCaneFactories	<< '\n';
		os << data.InhabitansPerIgloo	<< '\n';
		os << data.PolarbearGrinders	<< '\n';
		os << data.RaindeerFarms		<< '\n';
		os << data.Raindeers			<< '\n';
		os << data.KilosOfPolarbearMeat	<< '\n';
		os << data.RaindeerNumOfHelpers << '\n';
		for(unsigned int i = 0; i < MaxExpeditions; i++)
		{
			os << data.Expeditions[i]					<< '\n';
			os << data.TimeForExpeditionsToReturn[i]	<< '\n';
			os << data.TimeInExpedition[i]			<< '\n';
		}
		return os;
	}
#pragma endregion
	
};